package se.hrbustrc.hlgshopping.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 订单明细表
 * @TableName tb_order_item
 */
@TableName(value ="tb_order_item")
@Data
public class OrderItem implements Serializable {
    /**
     * 订单明细ID
     */
    @TableId(value = "FId",type = IdType.AUTO)
    private Long id;

    /**
     * 订单ID
     */
    @TableField("FOrderId")
    private Long orderid;

    /**
     * SPU ID
     */
    @TableField("FSPUId")
    private Long spuid;

    /**
     * 商品名称
     */
    @TableField("FName")
    private String name;

    /**
     * 购买数量
     */
    @TableField("FQuantity")
    private Integer quantity;

    /**
     * 商品图片URL
     */
    @TableField("FImage")
    private String image;

    /**
     * 实际支付单价
     */
    @TableField("FRealPay")
    private BigDecimal realpay;

    /**
     * 当前单价
     */
    @TableField("FCurPrice")
    private BigDecimal curprice;

    /**
     * 商品属性文本
     */
    @TableField("FAttrsText")
    private String attrstext;

    /**
     * 创建时间
     */
    @TableField("FCreateTime")
    private LocalDateTime createtime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        OrderItem other = (OrderItem) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getOrderid() == null ? other.getOrderid() == null : this.getOrderid().equals(other.getOrderid()))
            && (this.getSpuid() == null ? other.getSpuid() == null : this.getSpuid().equals(other.getSpuid()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getQuantity() == null ? other.getQuantity() == null : this.getQuantity().equals(other.getQuantity()))
            && (this.getImage() == null ? other.getImage() == null : this.getImage().equals(other.getImage()))
            && (this.getRealpay() == null ? other.getRealpay() == null : this.getRealpay().equals(other.getRealpay()))
            && (this.getCurprice() == null ? other.getCurprice() == null : this.getCurprice().equals(other.getCurprice()))
            && (this.getAttrstext() == null ? other.getAttrstext() == null : this.getAttrstext().equals(other.getAttrstext()))
            && (this.getCreatetime() == null ? other.getCreatetime() == null : this.getCreatetime().equals(other.getCreatetime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getOrderid() == null) ? 0 : getOrderid().hashCode());
        result = prime * result + ((getSpuid() == null) ? 0 : getSpuid().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getQuantity() == null) ? 0 : getQuantity().hashCode());
        result = prime * result + ((getImage() == null) ? 0 : getImage().hashCode());
        result = prime * result + ((getRealpay() == null) ? 0 : getRealpay().hashCode());
        result = prime * result + ((getCurprice() == null) ? 0 : getCurprice().hashCode());
        result = prime * result + ((getAttrstext() == null) ? 0 : getAttrstext().hashCode());
        result = prime * result + ((getCreatetime() == null) ? 0 : getCreatetime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", orderid=").append(orderid);
        sb.append(", spuid=").append(spuid);
        sb.append(", name=").append(name);
        sb.append(", quantity=").append(quantity);
        sb.append(", image=").append(image);
        sb.append(", realpay=").append(realpay);
        sb.append(", curprice=").append(curprice);
        sb.append(", attrstext=").append(attrstext);
        sb.append(", createtime=").append(createtime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}